<?php
    class SkyParser
    {
        public function htmlToXmlString($contentsString)
        {
            $all = split("~",$contentsString);
            $c = count($all);
            $coco=0;
            $newString = "<Advertisements>";
            $end = $c / 2;
            for ($i = 0; $i < $end; $i++)
            {
                    $newString .= "<Advertisement id =" . "\"" . $i . "\"" . ">";
                    $newString .= "<AdvertisementLink>" . $all[0 + $coco] . "</AdvertisementLink>";
                    $newString .= "<Date>" . $all[1 + $coco] . "</Date>";
                    $newString .= "</Advertisement>";
                    $coco += 2;          
            }
            $newString .= "</Advertisements>";
            $newString = str_replace("&", "", $newString);
            return $newstring;
        }
    }
?>
